package com.example.radiationarea.world.biome;

import com.example.radiationarea.RadiationAreaMod;
import com.example.radiationarea.block.ModBlocks;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.data.worldgen.features.OreFeatures;
import net.minecraft.data.worldgen.placement.OrePlacements;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
import net.minecraft.world.level.levelgen.placement.*;

import java.util.List;

public class RadiationBiome {
    public static final ResourceKey<ConfiguredFeature<?, ?>> RADIATION_SURFACE_CONFIGURED = 
        ResourceKey.create(Registry.CONFIGURED_FEATURE_REGISTRY, new ResourceLocation(RadiationAreaMod.MOD_ID, "radiation_surface"));
    
    public static final Holder<PlacedFeature> RADIATION_SURFACE = Holder.direct(
        new PlacedFeature(
            Holder.direct(
                new ConfiguredFeature<>(
                    Feature.ORE, 
                    new OreConfiguration(
                        List.of(OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, ModBlocks.CONTAMINATED_DIRT.get().defaultBlockState())), 
                        90
                    )
                )
            ),
            List.of(
                CountPlacement.of(20),
                InSquarePlacement.spread(),
                HeightRangePlacement.uniform(VerticalAnchor.bottom(), VerticalAnchor.top()),
                BiomeFilter.biome()
            )
        )
    );
}